package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.StrategyReplyUserComment;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.mapper.StrategyReplyUserCommentMapper;
import cn.wolfcode.trip.base.service.IStrategyReplyUserCommentSerivce;
import cn.wolfcode.trip.base.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StrategyReplyUserCommentSerivceImpl implements IStrategyReplyUserCommentSerivce {
    @Autowired
    private StrategyReplyUserCommentMapper replyCommentMapper;

    @Override
    public int selectTotalCountForUnreadComment() {
        return replyCommentMapper.selectTotalCountForUnreadComment(UserContext.getCurrentUser());
    }

    @Override
    public List<StrategyReplyUserComment> selectReply() {
        User user = UserContext.getCurrentUser();
        Boolean read =false;
        return replyCommentMapper.selectReply(user.getId(),read);
    }

    /**
     * 通过评论id 改变回复状态为已读
     * @param userCommentId
     */
    @Override
    public void updateRead(Long userCommentId) {

        replyCommentMapper.updataRead(userCommentId);
    }
}
